package com.ysx.teacher.day20210909.ch08.crm.client;

import com.ysx.teacher.day20210909.ch07.AnimalEntity;
import com.ysx.teacher.day20210909.ch07.AppleEntity;
import com.ysx.teacher.day20210909.ch07.CatEntity;
import com.ysx.teacher.day20210909.ch07.DogEntity;
import com.ysx.teacher.day20210909.ch08.crm.dao.AnimalDao;

public class AnimalTest {

    private static AnimalDao dao = new AnimalDao();

    public static void main(String[] args) {

        addTest();
        endsWithConditionTest();
        getCounterTest();
    }

    private static  void addTest(){
        init();
    }
    private static  void getCounterTest(){
        int counter =dao.getCounter(1000);
    }

    private static void endsWithConditionTest(){
        boolean rs =dao.endsWithCondition("Kitty");
        System.out.println(rs);
    }


    /**
     * 数据初始化
     * 模拟数据库 并且往数据库中插入一些数据
     */
    public static void init(){
        // double x=11;


        // 准备2只动物
        AnimalEntity cat  = new CatEntity();
        cat.setName("HelloKitty");
        cat.setPrice(1000);

        AnimalEntity dog  = new DogEntity();
        dog.setName("WorldKitty");
        dog.setPrice(500);

        //把这2只动物往乾坤袋中放
        dao.add(cat);
        dao.add(dog);
    }


}
